package cn.itsource.pethome.org.service.impl;

import cn.itsource.pethome.Basic.service.Impl.BaseServiceImpl;
import cn.itsource.pethome.org.constant.ShopConstant;
import cn.itsource.pethome.org.domain.Employee;
import cn.itsource.pethome.org.domain.Shop;
import cn.itsource.pethome.org.domain.Status;
import cn.itsource.pethome.org.mapper.ShopMapper;
import cn.itsource.pethome.org.mapper.StatusMapper;
import cn.itsource.pethome.org.service.IEmployeeService;
import cn.itsource.pethome.org.service.IShopService;
import cn.itsource.pethome.org.service.IStatusQueryService;
import cn.itsource.pethome.org.service.IStatusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class StatusServiceImpl extends BaseServiceImpl<Status> implements IStatusService  {
    @Autowired
    private StatusMapper statusMapper;
    @Autowired
    private ShopMapper shopMapper;

    @Override
    public void reject(Shop shop) {
        //获取状态
        List<Status> status = shop.getStatus();
        //将状态加入数据库
        for (Status status1 : status) {
            statusMapper.insert(status1);
        }


    }

    /**
     * 商户通过状态修改
     * @param status
     */
    @Override
    public void adopt(Status status) {
        shopMapper.update(status.getShop());
        statusMapper.adopt(status);
    }

}
